package cn.ycoz.cloud.windspeed.dao;

import cn.ycoz.cloud.windspeed.entity.Worker;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.data.rest.core.annotation.RestResource;

import java.util.List;

@RepositoryRestResource(path = "worker", collectionResourceRel = "data")
public interface WorkerRepo extends JpaRepository<Worker, Long> {

    /**
     * <a>http://127.0.0.1:5000/api/worker/search/</a>
     *
     * @param name
     * @return
     */
    @RestResource(path = "nameStartsWith", rel = "findByName")
    List<Worker> findByNameStartsWith(@Param("name") String name);
}